<html>
<head>
    @include('v1.common.meta')
    <link rel="stylesheet" href="{{elixir('css/basicdata.css')}}">
    <link rel="stylesheet" href="{{elixir('css/excellent_people.css')}}">
</head>
<body>
<div class="yjs-grid">
    <div class="yjs-grid-box">
        <div class="layui-tab">
            @if(Auth::check())
                <div class="layui-container">
                    @if($view==='addData')
                        {{--新增图文视图--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：新增数据时，存在"<i class="layui-icon">&#xe605;</i>"标识的表单项，建议您自主编辑维护；
                                                </blockquote>
                                            </div>
                                        </div>
                                        <div class="layui-row">
                                            <div class="layui-form layui-form-pane" name="teacherItemForm"
                                                 action="javascript:;" method="POST">
                                                <input type="hidden" name="viewType" value="{{$view}}">

                                                <div class="layui-col-md9">
                                                    <fieldset class="layui-elem-field">
                                                        <legend>名师风采信息维护</legend>
                                                        <div class="layui-field-box">

                                                            <div class="layui-row">
                                                                <div class="layui-col-md6">
                                                                    <div class="layui-form-item">
                                                                        <label class="layui-form-label"><i
                                                                                    class="layui-icon">&#xe605;</i>职工代码</label>
                                                                        <div class="layui-input-inline">
                                                                            <select id="faculty_code" name="faculty_code"
                                                                                    lay-filter="facultySel" lay-verify="required"
                                                                                    lay-search="">
                                                                                <option value="">直接选择或搜索选择</option>
                                                                                @foreach($faculties as $faculty)
                                                                                    @if(in_array($faculty["code"],$faculty_codes))
                                                                                        <option value="{{$faculty["code"].'-'.$faculty["name"].'-'.$faculty["title"].'-'.$faculty["department_name"].'-'.$faculty["specialty"].'-'.$faculty["avatar"]}}" disabled>{{$faculty["code"]}}</option>
                                                                                    @else
                                                                                        <option value="{{$faculty["code"].'-'.$faculty["name"].'-'.$faculty["title"].'-'.$faculty["department_name"].'-'.$faculty["specialty"].'-'.$faculty["avatar"]}}">{{$faculty["code"]}}</option>
                                                                                    @endif

                                                                                @endforeach
                                                                            </select>
                                                                        </div>
                                                                    </div>
                                                                </div>

                                                                <div class="layui-col-md6">
                                                                    <div class="layui-form-item">
                                                                        <label class="layui-form-label"><i
                                                                                    class="layui-icon">&#xe605;</i>名师姓名</label>
                                                                        <div class="layui-input-inline">
                                                                            <input type="text" id="faculty_name" name="faculty_name" disabled
                                                                                   lay-verify="required"
                                                                                   placeholder="请输入名师姓名"
                                                                                   class="layui-input">
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="layui-row">

                                                                <div class="layui-col-md6">
                                                                    <div class="layui-form-item">
                                                                        <label class="layui-form-label"><i
                                                                                    class="layui-icon">&#xe605;</i>担任职位</label>
                                                                        <div class="layui-input-inline">
                                                                            <input type="text" id="faculty_title" name="faculty_title" required
                                                                                   lay-verify="required"
                                                                                   placeholder="请输入名师职位"
                                                                                   class="layui-input">
                                                                        </div>
                                                                    </div>
                                                                </div>

                                                                <div class="layui-col-md6">
                                                                    <div class="layui-form-item">
                                                                        <label class="layui-form-label">所在部门</label>
                                                                        <div class="layui-input-inline">
                                                                            <input type="text" id="faculty_department" name="faculty_department" disabled
                                                                                   lay-verify="required"
                                                                                   placeholder="请输入名师所在部门"
                                                                                   class="layui-input">
                                                                        </div>
                                                                    </div>
                                                                </div>

                                                            </div>
                                                            <div class="layui-row">
                                                                <div class="layui-col-md12">
                                                                    <label class="layui-form-label"><i
                                                                                class="layui-icon">&#xe605;</i>专业特长</label>
                                                                    <div class="layui-input-block">
                                                                        <input type="text" id="faculty_specialty" name="faculty_specialty" required
                                                                               lay-verify="required"
                                                                               placeholder="请输入名师专业特长"
                                                                               class="layui-input">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="layui-row">
                                                                <div class="layui-col-md12">
                                                                    <label class="layui-form-label"><i
                                                                                class="layui-icon">&#xe605;</i>标题</label>
                                                                    <div class="layui-input-block">
                                                                        <input type="text" name="title" required
                                                                               lay-verify="required|title"
                                                                               placeholder="请输入标题"
                                                                               class="layui-input">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="layui-row">
                                                                <div class="layui-col-md12">
                                                                    <div class="layui-form-item layui-form-text">
                                                                        <label class="layui-form-label"><i
                                                                                    class="layui-icon">&#xe605;</i>内容</label>
                                                                        <div class="layui-input-block">
                                                            <textarea class="layui-textarea layui-hide" name="content"
                                                                      lay-verify="content" id="teacher_editor">
                                                            </textarea>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="layui-row">
                                                                <div class="layui-col-md6">
                                                                    <div class="layui-form-item">
                                                                        <label class="layui-form-label">验证码</label>
                                                                        <div class="layui-input-inline">
                                                                            <input type="text" name="captcha" maxlength="4"
                                                                                   lay-verify="required"
                                                                                   placeholder="请输入图片验证码" autocomplete="off"
                                                                                   class="layui-input">
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                                <div class="layui-col-md3">
                                                                    <div class="layui-form-item">
                                                                        <img class="getLVcode" src="{{ captcha_src('mini') }}"
                                                                             width="70px"
                                                                             height="34px" style="border: 1px solid green;"/>
                                                                        <div class="layui-form-mid layui-word-aux">
                                                                            点击图片刷新验证码
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                                <div class="layui-col-md3">
                                                                    {{--隐藏提交--}}
                                                                    <button id="toolbarSubmit" type="submit" class="layui-btn"
                                                                            lay-filter="toolbarEvent" lay-submit style="display: none;">
                                                                    </button>
                                                                </div>
                                                            </div>
                                                        </div>

                                                    </fieldset>
                                                </div>
                                                <div class="layui-col-md3">
                                                    <fieldset class="layui-elem-field">
                                                        <legend>名师头像编辑</legend>
                                                        <div class="layui-field-box">
                                                            <div class="layui-row">
                                                                <div class="layui-col-md12">
                                                                    <div class="layui-collapse">
                                                                        <div class="layui-colla-item">
                                                                            <h2 class="layui-colla-title">限制规则：</h2>
                                                                            <div class="layui-colla-content">
                                                                                <p>1.要求：本人正面照片，内容合规合法；</p>
                                                                                <p>2.格式：jpg、png、bmp、jpeg</p>
                                                                                <p>3.尺寸：91x91</p>
                                                                                <p>4.大小：少于2MB</p>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="layui-row">
                                                                <div class="layui-col-md1">
                                                                    &nbsp;
                                                                </div>
                                                                <div class="layui-col-md10">
                                                                    <div class="layui-upload-drag" id="avatar">
                                                                        <i class="layui-icon">&#xe681;</i>
                                                                        <p>点击上传，或将文件拖拽到此处</p>
                                                                    </div>
                                                                </div>


                                                                <div class="layui-col-md1">
                                                                    &nbsp;
                                                                </div>
                                                            </div>
                                                            <div class="layui-row">
                                                                <div class="layui-col-md3">
                                                                    &nbsp;
                                                                </div>
                                                                <div class="layui-col-md6">
                                                                    <div class="layui-upload-list yjs-user-photo"
                                                                         id="avatarViewer">
                                                                        <img class="layui-upload-img" layer-src="头像"
                                                                             layer-pid="" src="" id="faculty_avatar"
                                                                             alt="头像">
                                                                        {{--<div class="yjs-user-photo-edit">点击查看图</div>--}}
                                                                    </div>
                                                                </div>
                                                                <div class="layui-col-md3">
                                                                    &nbsp;
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </fieldset>
                                                </div>
                                            </div>

                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>

                    @elseif($view==='viewData')
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>查看【{{$teacher['name']}}】名师风采信息</legend>
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：查看数据时，所有表单项均不可修改。
                                                </blockquote>
                                            </div>
                                        </div>
                                        <div class="layui-form layui-form-pane">
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">职工代码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$teacher['code']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label" >名师姓名</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$teacher['name']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">担任职位</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$teacher['title']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">所在部门</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$teacher['department_name']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">专业特长</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$teacher['specialty']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="layui-row">
                                                <div class="layui-col-md12">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">标题</label>
                                                        <div class="layui-input-block">
                                                            <input type="text" value="{{$itemData['title']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="layui-row">
                                                <div class="layui-col-md12">
                                                    <div class="layui-form-item layui-form-text">
                                                        <label class="layui-form-label">内容</label>
                                                        <div class="layui-input-block">
                                                            <textarea  id="teacher_editor" disabled>{{$itemData['content']}}</textarea>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>

                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">创建时间</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['created_at']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">更新时间</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['updated_at']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>

                    @else
                        {{--视图类型不正确--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <blockquote class="layui-elem-quote-error">
                                    友情提示：视图类型不正确，无法支持后续操作。
                                </blockquote>
                            </div>
                        </div>
                    @endif
                </div>
            @else
                <div class="layui-container">
                    <div class="layui-row">
                        <div class="layui-col-md12">
                            <blockquote class="layui-elem-quote-error">
                                友情提示：该功能只面向已成功登录系统，并具有相应权限的用户可用。
                            </blockquote>
                        </div>
                    </div>
                </div>
            @endif
        </div>
    </div>
</div>

@include('v1.common.js')
<script src="{{elixir('js/excellentTeachersItem.js')}}"></script>
</body>
<script type="text/html">
    <input type="hidden" id="rspStatus" value="">
    <input type="hidden" id="rspMsg" value="">
</script>
<style>
    .layui-form-checkbox span{padding:0 10px;height:5%;font-size:14px;background-color:#d2d2d2;color:#fff;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
</style>
</html>